<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\MajorSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Majors';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="major-index">

    <?php Pjax::begin(); ?>
    <div class="panel">
		<div class="panel-heading panel-heading-auto">
            <?php echo $this->render('_search', ['model' => $searchModel]); ?>
		</div>
        <div class="panel-body">

    <?= GridView::widget([
        'layout' => "{items}\n{pager}",
        'tableOptions' => ['class' => 'table table-hover table-bordered'],
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn', 'header' => '序号'],

            //'ID',
            //'XXID',
            [
                'attribute' => 'XXID',
                'label' => '学校',
                'value' => function ($model){ return $model->xX->ZWMC; },
            ],
            //'BMID',
            'ZYDM',
            'ZYMC',
            //'ZYJC',
            //'BXZYBH',
            //'ZYJS:ntext',
            'KSSJ',
            //'CXSJ',
            'ZYMLBB',
            'ZYLB',
            //'ZYFX',
            'ZSLB',
            'XZ',
            'JXXS',
            //'ZXF',
            //'BXXF',
            //'SFGK',
            //'SFSN',
            //'ZSZG',
            [
                'attribute' => 'ZT',
                'value' =>  function ($model){  if($model->ZT == 0){return "待审核";}
                                else if($model->ZT == -1){return "驳回";}
                                else if($model->ZT == 1){return "已批准";} 
                            },
            ],


            ['class' => 'yii\grid\ActionColumn', 'header'=>'操作' , 'template'=>"{/major/audit}", 'buttons' => [
                '/major/audit' => function ($url, $model, $key) {
                    return  Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => '审核'] ) ;
                },
            ],]
        ],
    ]); ?>

		</div>
	</div>
    <?php Pjax::end(); ?>

</div>
